package com.taptech.doufu.weex;

import android.content.Intent;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import com.taptech.doufu.ui.activity.NewOthersPersonalActivity;
import com.taptech.doufu.constant.Constant;

/**
 * Created by qlx on 2017/3/16.
 */


public class TFClickableSpan extends ClickableSpan implements View.OnClickListener
{

    private String user_nickName;
    private  int color ;

    public TFClickableSpan(String user_nickName , int color)
    {
        this.user_nickName = user_nickName;
        this.color = color;

    }

    @Override
    public void updateDrawState(TextPaint ds)
    {
        ds.setColor(color);
        ds.setUnderlineText(false);
    }

    @Override
    public void onClick(final View v)
    {
//        if (type == Constant.AT_CLICK)
//        {
//            if (AccountService.getInstance().isLogin())
//            {
//                if (AccountService.getInstance().getBaseAccount() != null && !AccountService.getInstance().getBaseAccount().getNickname().trim().equals(user_nickName))
//                {
//                    Intent intent = new Intent(v.getContext(), NewOthersPersonalActivity.class);
//                    intent.putExtra(Constant.USERNICKNAME, user_nickName);
//                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                    v.getContext().startActivity(intent);
//                }
//            } else
//            {
                Intent intent = new Intent(v.getContext(), NewOthersPersonalActivity.class);
                intent.putExtra(Constant.USERNICKNAME, user_nickName);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                v.getContext().startActivity(intent);

//            }
//        }

    }
}
